<?php
$provinces = [
    [
        'id' => 1,
        'title' => '河北省'
    ],
    [
        'id' => 2,
        'title' => '河南省'
    ]
]
?>
<html>
<head>
    <title>ajax实现级联菜单</title>
</head>
<body>
<select id="province">
    <option value="0">请选择省份</option>
    <?php foreach ($provinces as $p):?>
    <option value="<?php echo $p['id'];?>"><?php echo $p['title'];?></option>
    <?php endforeach;?>
</select>
<select id="city">
    <option value="0">请选择城市</option>
</select>
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
    jQuery(function() {
        jQuery('#province').change(function() {
            var params = {
                province_id: jQuery('#province').val()
            }
            jQuery.get('/c5/get-city-by-province.php', params, function(data) {
                jQuery('#city').html(data)
            })
        })
    })
</script>
</html>
